/**
 * Created by Shinelon on 2017-12-14.
 */
$(function () {
			$(function () {
            $("#right3>div").click(function () {
                $(this).css('border','1px blue solid');
                $(this).siblings().css('border','1px #dcdcdc solid');
                var neic=$(this).children('span').text();
                 var jiaqian=$(this).children('div').text();
                $(".left2>span:nth-of-type(2)").text(neic);
                $("#zj").text(jiaqian);
            })
            var xin=$('<div id="1220"><div class="zuo1"><a>坚果Pro2</a>&nbsp;&nbsp;&nbsp;概况&nbsp;&nbsp;&nbsp; 设计&nbsp;&nbsp;&nbsp; 功能&nbsp;&nbsp;&nbsp; 操作系统&nbsp;&nbsp;&nbsp; 技术规格</div><div class="you1">优先购买码&nbsp;&nbsp;&nbsp;丨&nbsp;&nbsp;&nbsp;手机回收置换计划</div></div>');
            
            $(document).scroll(function () {
                var fangda=$(document).scrollTop();
//                alert(fangda);
                if(fangda>80){
                    $(".kuan12200").hide();
                    xin.appendTo('body>div:nth-of-type(2)');

                }else {
                    $(".kuan12200").show();
                    xin.remove();
                }
            })

            $(document).scroll(function () {
                var di=$(document).scrollTop();
                if(di>100){
                    $('#baifenbai2').appendTo('body>div:nth-of-type(4)');
                }
            })
            // 选择颜色
            $("#right4>div>div>div").click(function () {
                $(this).css('border','2px #000000 solid');
                $(this).parent('div').siblings().children('div').css('border','2px #b4b4b4 solid');
                var jia = $(this).parent('div').children('span').text()
                if(jia=='炭黑色'){
                    $('.lefttu').children('img').attr('src','images/锤子科技官网_14.gif')
                }
                if(jia=='酒红色'){
                    $('.lefttu').children('img').attr('src','images/QQ图片20171221214746.jpg')
                }
                if(jia=='浅金色'){
                    $('.lefttu').children('img').attr('src','images/QQ图片20171221214736.png')
                }



                $('.yanse').text(jia);
                console.log(jia)
            })
	        $('.ban').hide()
            $(document).scroll(function () {
                var fangda = $(document).scrollTop();
                if (fangda > 80) {
                    $('.ban').slideDown(500);
                } else if (fangda <= 80) {
                    $(".ban").slideUp(500);
                }
            });

            var hao = []
            $('#gouwuche').click(function () {
                var jia = {};
                jia.img = $('.lefttu').children('img').attr('src');
                var a = $('.left2').text()
                jia.ming =a.substring(5,a.length)
                jia.qian = $('#zj').text();
                jia.shuliang = parseInt('1');
                hao.push(jia);
                var huan = JSON.stringify(hao);
                sessionStorage.setItem('shu',huan);
            })

            $('#gouwuche').click(function () {

            })
        })
        })

